(function(){
	var first_01=$("#first"),
		r1= /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,
		second_02=$("#second"),
		third_03=$("#third"),
		four_04=$("#four"),
		chongxinfasong=$(".huan_yz"),
		yx_float=$(".yx_float"),
		youxianggeshi=$("#youxianggeshi"),
		diyi=$("#diyi"),
		dier=$("#dier"),
		disan=$("#disan"),
		disi=$("#disi"),
		fasongyouxiang=$("#disan p"),
		shuruyouxiang=$("#shuruyouxiang"),
		yanzhengyouxiang=$("#yanzhengyouxiang"),
		genghuanchenggong=$("#genghuanchenggong");
		first_01.on("click",function(){
			diyi.css("display","none");
			dier.css("display","block");
			shuruyouxiang.addClass("active");
			shuruyouxiang.css("margin-left","-20px");
		})
		youxianggeshi.on("blur",function(){
			if(r1.test(youxianggeshi.val())==false){
				yx_float.css("opacity","1");
			}else{
				second_02.on("click",function(){
					dier.css("display","none");
					disan.css("display","block");
					fasongyouxiang.text(youxianggeshi.val());	
					yanzhengyouxiang.addClass("active");
					yanzhengyouxiang.css("margin-left","-20px");
					
				})
			}
		})
		//跳转到指定的邮箱登录页面
            third_03.click(function () {
                var uurl = youxianggeshi.val();
                uurl = gotoEmail(uurl);
                if (uurl != "") {
                	window.open("http://"+uurl);
                } else {
                    alert("抱歉!未找到对应的邮箱登录地址，请自己登录邮箱查看邮件！");
                }
            });
            //功能：根据用户输入的Email跳转到相应的电子邮箱首页
            function gotoEmail($mail) {
                $t = $mail.split('@')[1];
                $t = $t.toLowerCase();
                if ($t == '163.com') {
                    return 'mail.163.com';
                } else if ($t == 'vip.163.com') {
                    return 'vip.163.com';
                } else if ($t == '126.com') {
                    return 'mail.126.com';
                } else if ($t == 'qq.com' || $t == 'vip.qq.com' || $t == 'foxmail.com') {
                    return 'mail.qq.com';
                } else if ($t == 'gmail.com') {
                    return 'mail.google.com';
                } else if ($t == 'sohu.com') {
                    return 'mail.sohu.com';
                } else if ($t == 'tom.com') {
                    return 'mail.tom.com';
                } else if ($t == 'vip.sina.com') {
                    return 'vip.sina.com';
                } else if ($t == 'sina.com.cn' || $t == 'sina.com') {
                    return 'mail.sina.com.cn';
                } else if ($t == 'tom.com') {
                    return 'mail.tom.com';
                } else if ($t == 'yahoo.com.cn' || $t == 'yahoo.cn') {
                    return 'mail.cn.yahoo.com';
                } else if ($t == 'tom.com') {
                    return 'mail.tom.com';
                } else if ($t == 'yeah.net') {
                    return 'www.yeah.net';
                } else if ($t == '21cn.com') {
                    return 'mail.21cn.com';
                } else if ($t == 'hotmail.com') {
                    return 'www.hotmail.com';
                } else if ($t == 'sogou.com') {
                    return 'mail.sogou.com';
                } else if ($t == '188.com') {
                    return 'www.188.com';
                } else if ($t == '139.com') {
                    return 'mail.10086.cn';
                } else if ($t == '189.cn') {
                    return 'webmail15.189.cn/webmail';
                } else if ($t == 'wo.com.cn') {
                    return 'mail.wo.com.cn/smsmail';
                } else if ($t == '139.com') {
                    return 'mail.10086.cn';
                } else {
                    return '';
                }
            };	
		 /**绑定成功的时候*/
           chongxinfasong.on("click",function(){
           		diyi.css("display","none");
           		disan.css("display","none");
           		dier.css("display","none");
           		disi.css("display","block");
           		genghuanchenggong.addClass("active");
				genghuanchenggong.css("margin-left","-20px");
           })
           four_04.on("click",function(){
           		location.href="zhang_hbd_end.html";
           })
})();
